﻿using System;
using System.Collections.Generic;
using System.Text;
using Core.EF.Entitys;
using Core.EF.Repositories;

namespace Core.EF.Service
{
    public class TestService : ITestService
    {
        private IEntityBaseRepository<Blog> _baseRepository;

        public TestService(IEntityBaseRepository<Blog> baseRepository)
        {
            _baseRepository = baseRepository;
        }


        /// <summary>
        /// 新增一条记录
        /// </summary>
        /// <param name="blog"></param>
        public void Add(Blog blog)
        {
            _baseRepository.Add(blog);
            _baseRepository.Commit();
        }


        /// <summary>
        /// 获取一条记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Blog Get(int id)
        {
           var blg =  _baseRepository.GetSingle(id);

            return blg;
        }
    }
}
